import request from '@/utils/request'
// import qs from 'qs'

// 动态路由

// ISIS获取状态
export function getIsisStatus (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisStatus',
    method: 'post',
    data
  })
}

// ISIS设置状态
export function setIsisStatus (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisStatus',
    method: 'post',
    data
  })
}

// ISIS获取路由器类型
export function getIsisType (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisType',
    method: 'post',
    data
  })
}

// ISIS设置路由器类型
export function setIsisType (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisType',
    method: 'post',
    data
  })
}

// ISIS获取Cost类型
export function getIsisCostType (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisCostType',
    method: 'post',
    data
  })
}

// ISIS设置Cost类型
export function setIsisCostType (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisCostType',
    method: 'post',
    data
  })
}

// ISIS获取网络实体名称
export function getIsisNet (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisNet',
    method: 'post',
    data
  })
}

// ISIS设置网络实体名称
export function setIsisNet (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisNet',
    method: 'post',
    data
  })
}

// ISIS获取定时器
export function getIsisTimers (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisTimers',
    method: 'post',
    data
  })
}

// ISIS设置定时器
export function setIsisTimers (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisTimers',
    method: 'post',
    data
  })
}

// ISIS获取路由
export function getIsisRoute (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisRoute',
    method: 'post',
    data
  })
}

// ISIS获取接口配置信息
export function getIsisIfconfig (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/getIsisIfconfig',
    method: 'post',
    data
  })
}

// ISIS编辑接口配置信息
export function setIsisIfconfig (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/setIsisIfconfig',
    method: 'post',
    data
  })
}

// ISIS添加接口配置信息
export function addIsisIfconfig (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/addIsisIfconfig',
    method: 'post',
    data
  })
}

// ISIS删除接口配置信息
export function delIsisIfconfig (params) {
  var data = fromData(params)
  return request({
    url: 'dynamic_route/delIsisIfconfig',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}

// function fromData (params) {
//   var data = qs.stringify(params)
//   return data
// }
